package aod.android.com.bernay.mine.fragment;

import android.support.v4.content.ContextCompat;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.zhy.adapter.recyclerview.CommonAdapter;

import java.util.ArrayList;
import java.util.List;

import aod.android.com.bernay.R;
import aod.android.com.bernay.base.BernayBaseFragment;
import aod.android.com.bernay.mine.adapter.AlbumAdapter;
import aod.android.com.bernay.mine.module.AlbumBean;
import chen.lion.hilib.view.bind.HiView;

/**
 * @author crated by zhixianuanyang on 2019/4/12 14:25
 * @Email jamesKing0812@gmail.com
 */
public class VedioFragment extends BernayBaseFragment {

    @HiView(R.id.albumRecycleView)
    RecyclerView mAlbumRecycleView;

    private AlbumAdapter albumAdapter;
    private CommonAdapter<String> mAlbumDapter;
    private List<AlbumBean> mAlbumDatas = new ArrayList<>();

    @Override
    protected int initLayout() {
        return R.layout.fragment_album;
    }

    @Override
    protected void initData() {
        //布局样式
        mAlbumRecycleView.setLayoutManager(new LinearLayoutManager(getActivity()));
        mAlbumDatas.addAll(AlbumBean.mAlbumBeans);
        //分割线
        DividerItemDecoration divider = new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL);
        divider.setDrawable(ContextCompat.getDrawable(getActivity(),R.drawable.divider_mileage));
        mAlbumRecycleView.addItemDecoration(divider);
        //添加适配器
        albumAdapter = new AlbumAdapter(getActivity(), mAlbumDatas);
        mAlbumRecycleView.setAdapter(albumAdapter);

        //点击事件
        albumAdapter.setOnItemClickListener(new AlbumAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(int position) {

            }
        });
    }
}
